package cn.lg.soar.system.auth.entity;

import cn.lg.soar.core.annotations.constraints.group.Create;
import cn.lg.soar.core.util.easyexcel.converters.BooleanConverter;
import cn.lg.soar.database.base.entity.BaseEntity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;

/**
 * 系统资源
 * @author luguoxiang
 * @since 2022-04-30
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@Getter
@Setter
@Accessors(chain = true)
@ApiModel(value = "Resource", description = "系统资源")
@TableName("lg_sys_resource")
public class Resource extends BaseEntity {

    private static final long serialVersionUID = -4311320070831941456L;

    @ApiModelProperty(value = "id")
    @TableId
    private Long id;

    @NotBlank(message = "资源编码不能为空", groups = { Create.class })
    @ExcelProperty(value = "资源编码")
    @ApiModelProperty(value = "资源编码")
    private String code;

    @NotBlank(message = "资源名称不能为空", groups = { Create.class })
    @ExcelProperty(value = "资源名称")
    @ApiModelProperty(value = "资源名称")
    private String name;

    @ExcelProperty(value = "是否禁用", converter = BooleanConverter.class)
    private Boolean disabled;

    @JsonIgnore
    @Override
    public Serializable primaryKey() {
        return this.id;
    }

}
